﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Reflection;
using Gammar.Digger.IDAL;

namespace Gammar.Digger.DALFactory
{
    /// <summary>
    /// 自定义对象创建类
    /// </summary>
    public partial class DataAccess
    {
        /// <summary>
        /// create Parent_Class instance(defalut),SqlServer
        /// </summary>
        /// <returns></returns>
        public static IParent_Class CreateParent_Class()
        {
            className = dalSqlServer + ".Parent_Class";

            return (Assembly.Load(dalSqlServer).CreateInstance(className) as IParent_Class);
        }

        /// <summary>
        /// create new Customers instance (new connectionString),SqlServer
        /// </summary>
        /// <param name="newConn">new connectionString name</param>
        /// <returns></returns>
        public static IParent_Class CreateParent_Class(string newConn)
        {
            className = dalSqlServer + ".Parent_Class";

            return (Assembly.Load(dalSqlServer).CreateInstance(className, false, BindingFlags.Default, null, new object[] { newConn }, null, null) as IParent_Class);
        }

        /// <summary>
        /// create Child_Class instance(defalut),SqlServer
        /// </summary>
        /// <returns></returns>
        public static IChild_Class CreateChild_Class()
        {
            className = dalSqlServer + ".Child_Class";

            return (Assembly.Load(dalSqlServer).CreateInstance(className) as IChild_Class);
        }

        /// <summary>
        /// create new Customers instance (new connectionString),SqlServer
        /// </summary>
        /// <param name="newConn">new connectionString name</param>
        /// <returns></returns>
        public static IChild_Class CreateChild_Class(string newConn)
        {
            className = dalSqlServer + ".Child_Class";

            return (Assembly.Load(dalSqlServer).CreateInstance(className, false, BindingFlags.Default, null, new object[] { newConn }, null, null) as IChild_Class);
        }
    }
}
